package jf.collections;

import java.util.*;

import jf.collections.iterators.RightIterator;

/**
 * @author alex
 * @date 17.05.2009
 */
public class ArrayListX<A> extends AbstractListX<A> {

	private final List<A> list;

	public ArrayListX() {
		list = new ArrayList<A>();
	}

	public ArrayListX(int capacity) {
		list = new ArrayList<A>(capacity);
	}

	public ArrayListX(Collection<? extends A> lst) {
		list = new ArrayList<A>(lst);
	}

	protected List<A> getBaseCollection() {
		return list;
	}

	public Iterator<A> rightIterator() {
		return new RightIterator<A>(this);
	}

	public <B> ListX<B> createNewList(int capacity) {
		return new ArrayListX<B>(capacity);
	}

	public <B> ListX<B> createNewList() {
		return new ArrayListX<B>();
	}

	public <B> ListX<B> createNewList(Collection<? extends B> inital) {
		return new ArrayListX<B>(inital);
	}

}
